<template>
    <div>
        <header class="head">多路分发配置</header>
        <el-form label-width="100px">
            <el-form-item label="并行分发：">
                <el-checkbox
                        v-model="formData.parallel_processing"
                        :disabled="isView"
                ></el-checkbox>
            </el-form-item>
            <el-form-item label="异常停止：">
                <el-checkbox
                        v-model="formData.stop_on_exception"
                        :disabled="isView"
                ></el-checkbox>
                <span style="font-size: 12px; margin-left: 10px">仅串行时有效</span>
            </el-form-item>
            <el-form-item label="超时(毫秒)：">
                <el-input
                        v-model="formData.timeout"
                        :disabled="isView"
                        type="number"
                        style="width: 50%"
                />
                <span style="font-size: 12px">（-1表示一直等待）</span>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
import {serviceStore} from '@slc/store/service';
import {flowServiceStore} from '@slc/store/flowService';
import {mapState, mapActions} from 'pinia';


export default {
    name: "custom-distribute",
    computed: {
        ...mapState(flowServiceStore, ["moreNodeInfo", "currentNodeId"]),
        ...mapState(serviceStore, ["dialogStatus", "dialogVersionStatus"]),
        formData: {
            get() {
                return this.moreNodeInfo[this.currentNodeId];
            },
            set(val) {
                this.setMoreNodeInfo({
                    ...this.moreNodeInfo,
                    [this.currentNodeId]: val,
                });
            },
        },
        isView() {
            return (
                this.dialogStatus === "view" || this.dialogVersionStatus === "view"
            );
        },
    },
    methods: {
        ...mapActions(flowServiceStore, ["setMoreNodeInfo"]),
    }
}
</script>

<style lang="scss" scoped>
.head {
  height: 40px;
  text-align: center;
  line-height: 40px;
  color: #333;
  font-weight: bold;
  font-size: 14px;
  background-color: #ccc;
  margin-bottom: 16px;
}

:deep(.el-form-item) {
  margin-bottom: 0px;
}
</style>
